package com.batchaps.menu;

import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.List;

import com.batchaps.gameentity.MenuFuntionItem;

public class MainMenu extends Menu{

	public int iMenu; //0 : default , 1 : start , 2 : help , 3:about , 4:Quit
	public MenuFuntionItem[] menuFuntion;
	int size = 4;
	
	public MainMenu(int width , int height)
	{
		Width = width;
		Height = height;
		iMenu = 0;
		
		menuFuntion = new MenuFuntionItem[size];
		for(int i  = 0 ; i < size ; i++)
		{
			menuFuntion[i] = new MenuFuntionItem("/menu/menu"+i +".png", 164-i*30 , 132, 30, 140, "", 0, 0, true);
		}
		iMenu = 0;
	}
	
	public int IsClick(int x, int y) {
		// TODO Auto-generated method stub
		if(menuFuntion[0].IsClick(x, y))//new game
		{
			iMenu = 1;
			return 1;
		}else
		if(menuFuntion[1].IsClick(x, y))//help
		{
			iMenu = 2;
			return 2;
		}else
		if(menuFuntion[2].IsClick(x, y))//about
		{
			iMenu = 3;
			return 3;
		}else
		if(menuFuntion[3].IsClick(x, y))//exit
		{
			iMenu = 5;
			return 5;
		}
		else
		{
			iMenu = 0;
			return 0;
		}
	}
	
	public void Draw(Graphics g) {
		
		// TODO Auto-generated method stub
		for(int i = 0 ; i < size ;i++)
			menuFuntion[i].Draw(g, 10);
	}

	public void Update() {
		// TODO Auto-generated method stub
		
	}

}
